<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\models\Sms;

/* @var $this yii\web\View */
/* @var $searchModel common\models\SmsSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '短信管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="sms-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('创建短信', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'tableOptions' => ['class' => 'table table-striped table-bordered','style'=>'width:auto;max-width:none;'],
        'options' => ['class' => 'grid-view','style'=>'overflow:auto'],
        'columns' => [
            'id',
            'user_id',
            'tel',
            'content:ntext',
            [
                'attribute' => 'send_status',
                'value' => function ($model, $key, $index, $column) {
                    return Sms::itemAlias("send_status", $model->send_status);
                },
                'filter'=>Sms::itemAlias("send_status"),
            ],   
            [
                'attribute' => 'type',
                'value' => function ($model, $key, $index, $column) {
                    return Sms::itemAlias("type", $model->type);
                },
                'filter'=>Sms::itemAlias("type"),
            ],   
             [
                'attribute' => 'auto_send',
                'value' => function ($model, $key, $index, $column) {
                    return Sms::itemAlias("auto_send", $model->auto_send);
                },
                'filter'=>Sms::itemAlias("auto_send"),
            ], 
            'create_time',
            'remark',

            // 'update_time',
            // 'admin_id',
            // 'auto_send',
            // 'send_status',
            // 'weight',
            // 'tpl_id',
            // 'type',
            ['class' => 'yii\grid\ActionColumn', 'template' => '{view}',],

        ],
    ]); ?>
</div>
